<!doctype html>
<html>
 <head> 
  <meta charset="utf-8"> 
  <title>inputTags 增强版 标签输入框 inputTags-enhance - layui 第三方组件平台</title> 
  <meta name="renderer" content="webkit"> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 
  <meta name="description" content="输入回车生成标签"> 
  <link rel="stylesheet" href="/t/font_24081_60slu02pimt.css">
  <link rel="stylesheet" href="/layui/dist/css/layui.css">
  <link rel="stylesheet" href="/static/css/fly/global.css" charset="utf-8">
  <link rel="stylesheet" href="/static/css/global.css" charset="utf-8">
  <link rel="stylesheet" href="/static/css/global.css" charset="utf-8">
 </head>
 <body>
  <div class="layui-header header header-extends" style="background-color: #24262F;"> 
   <div class="layui-container"> <a class="logo" href="https://layui.itmtr.cn/"> <img src="/static/images/layui/logo.png" alt="layui"> </a> 
    <div class="layui-form component" lay-filter="LAY-site-header-component"></div> 
    <ul class="layui-nav"> 
     <li class="layui-nav-item layui-hide-xs"> <a href="//layui.itmtr.cn/">框架</a> </li> 
     <li class="layui-nav-item layui-hide-xs layui-this"> <a href="/extend/index.html">扩展</a> </li> 
     <li class="layui-nav-item"> <a href="javascript:;">周边</a> 
      <dl class="layui-nav-child layui-nav-child-c"> 
       <dd lay-unselect> <a href="//layui.itmtr.cn/alone.html" target="_blank">独立组件</a> 
       </dd> 
       <dd class="layui-hide-sm layui-show-xs" lay-unselect> <a href="/extend/index.html">扩展组件</a> 
        <hr> 
       </dd> 
      </dl> </li> 
    </ul> 
   </div>
  </div><!--[if lt IE 9]>  <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>  <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script><![endif]--> 
  <div class="fly-extend-banner fly-extend-banner-sm"> 
   <div class="layui-carousel" id="FLY-extend-banner" data-height="200px"> 
    <div carousel-item> 
     <div style="background-image: url(/upload/2018_8/168_1535373858670_8825.jpg)">
      <div style="background: rgba(0,0,0,.6)"></div> 
     </div> 
    </div> 
   </div> 
   <h1 class="fly-extend-banner-title">layui 第三方组件平台</h1> 
   <div class="fly-extend-banner-release"> <a href="/extend/index.html" class="layui-btn layui-btn-lg">返回首页</a>
   </div> 
  </div>
  <div class="fly-extend-detail layui-card"> 
   <div class="layui-container"> 
    <div class="fly-extend-list-header"> 
     <h1 class="fly-extend-title layui-elip"> <a>inputTags 增强版 标签输入框</a> <span class="layui-badge layui-bg-green layui-hide-xs">inputTags-enhance</span> </h1> 
     <div class="fly-extend-list-info"> <a href="/u/73511424/index.html" target="_blank" class="fly-extend-list-user" title="发布者"> <cite class="layui-hide-xs">hi**6</cite> <img src="/g" alt="hi**6"> </a> 
     </div> 
    </div> 
    <blockquote class="fly-extend-list-desc layui-elem-quote"> 
     <p>输入回车生成标签</p> 
    </blockquote> 
    <div class="fly-extend-list-bottom"> <span class="layui-inline">创建：2021-5-2 </span> 
     <div class="layui-btn-container layui-extend-doc-edit"> 
     </div> 
    </div> 
   </div>
  </div>
  <div class="layui-container"> 
   <div class="layui-row layui-col-space20"> 
    <div class="layui-col-sm3 layui-col-md2"> 
     <div class="layui-card"> 
      <ul class="fly-extend-doc-nav" lay-filter="extend-doc-nav"> 
       <li class="layui-this" lay-id="doc"> <a href="javascript:;"><i class="iconfont icon-wendang"></i> 文档</a> </li> 
       <li lay-id="download"> <a href="javascript:;"><i class="iconfont icon-xiazai"></i> 下载</a> </li> 
       <li lay-id=""> <a href="https://gitee.com/xiehanhan/input-tags-enhanced" rel="nofollow" target="_blank"> <i class="iconfont icon-kaifashili"></i> 来源 </a> </li> 
      </ul> 
     </div> 
    </div> 
    <div class="layui-col-sm9 layui-col-md10"> 
     <div class="layui-card fly-extend-doc layui-show"> 
      <div class="layui-card-header"> 
       <h3 class="layui-inline layui-this">文档</h3> 
      </div> 
      <div class="layui-card-body detail-body photos layui-text">
        原组件inputTags：<a href="/extend/inputTags/" target="_blank">/extend/inputTags/</a>
       <br>
       <br>在使用过程中发现一些选择器存在局限性问题，于是进行了修改；以及功能做了一些增强，使其更加满足使用需求。
       <br>
       <br>主要增强功能包含两点：
       <br>
       <hr>1.增加openFlatContent、flatContent属性：原组件使用时，当一个页面存在多个inputTags时，只能保证每个inputTags的content中的元素不重复，无法保证多个inputTags的content中的元素不重复。
       <br>使用：只需在渲染时将openFlatContent设置为true即可。openFlatContent为true代表使用flatContent,多个开启了flatContent的inputTags的元素不能重复，反之代表不使用flatContent，可以与其他inputTags包含相同元素；可以通过inputTags.flatContent获取flatContent。
       <br>
       <br>2.增加pinArray属性：原组件使用时，生成的tags都有close按钮，而需求有时包含一些内置内容，强制要求包含时，只需在inputTags渲染时将需要需要内置的内容加入至pinArray即可，多个inputTags的pinArray相互独立。
       <br>
       <hr>使用截图：
       <br>渲染代码
       <br>
       <img src="/upload/2021_4/73511424_1618542664074_99742.png"> 
       <br>初次加载
       <br>
       <img src="/upload/2021_4/73511424_1618542695000_98283.png"> 
       <br>pinArray效果展示
       <br>
       <img src="/upload/2021_4/73511424_1618542731519_8332.png"> 
       <br>flatContent效果展示
       <br>
       <img src="/upload/2021_4/73511424_1618543116592_23581.png"> 
       <br>
       <img src="/upload/2021_4/73511424_1618543125351_70997.png"> 
       <br>
       <hr>快速上手
       <br>HTML：
       <br>
       <pre>                        &lt;form class="layui-form"&gt;<br>                          &lt;div class="layui-field-box"&gt;<br>                            &lt;div class="layui-form-item" style="width: 90%;margin-left: 5%"&gt;<br>                                &lt;label class="layui-form-label mylabel" style="font-size: 15px;color: #ff6436"&gt;&lt;i<br>                                        class="iconfont"&gt;&lt;/i&gt; 一级结构&lt;/label&gt;<br>                                &lt;div class="layui-input-block tags"&gt;<br>                                    &lt;input class="layui-input " type="text" id="phase" placeholder="回车生成标签" autocomplete="off"/&gt;<br>                                &lt;/div&gt;<br>                            &lt;/div&gt;<br>                        &lt;/div&gt;<br>                        &lt;div class="layui-field-box"&gt;<br>                            &lt;div class="layui-form-item" style="width: 90%;margin-left: 5%"&gt;<br>                                &lt;label class="layui-form-label mylabel" style="font-size: 15px;color: #dca300"&gt;&lt;i<br>                                        class="iconfont"&gt;&lt;/i&gt; 二级结构&lt;/label&gt;<br>                                &lt;div class="layui-input-block tags"&gt;<br>                                    &lt;input class="layui-input" type="text" id="building" placeholder="回车生成标签" autocomplete="off"/&gt;<br>                                &lt;/div&gt;<br>                            &lt;/div&gt;<br>                        &lt;/div&gt;<br>                        &lt;div class="layui-field-box"&gt;<br>                            &lt;div class="layui-form-item" style="width: 90%;margin-left: 5%"&gt;<br>                                &lt;label class="layui-form-label mylabel" style="font-size: 15px;color: #63bf00"&gt;&lt;i<br>                                        class="iconfont"&gt;&lt;/i&gt; 三级结构&lt;/label&gt;<br>                                &lt;div class="layui-input-block tags"&gt;<br>                                    &lt;input class="layui-input" type="text" id="unit" placeholder="回车生成标签" autocomplete="off"/&gt;<br>                                &lt;/div&gt;<br>                            &lt;/div&gt;<br>                        &lt;/div&gt;<br>                        &lt;div class="layui-form-item"&gt;<br>                         &lt;div class="layui-input-block"&gt;<br>                            &lt;button class="layui-btn" type="button" id="test"&gt;测试&lt;/button&gt;<br>                         &lt;/div&gt;<br>                        &lt;/div&gt;<br>                     &lt;/form&gt;</pre>JS：
       <br>
       <pre>layui.use(['inputTags','form'], function () {<br>    var inputTags = layui.inputTags;<br>    $("#test").on("click",function (){<br>        console.log(JSON.stringify(structShield))<br>        console.log(inputTags.flatContent)<br>    })<br><br>    var structShield={<br>        phase:[],<br>        building:[],<br>        unit:[]<br>    }<br>    inputTags.render({<br>        elem:'#phase',<br>        content: ['期'],<br>        pinArray: ['期'],<br>        openFlatContent: true,<br>        aldaBtn: false,<br>        done: function(){<br>            structShield.phase=this.content;<br>        }<br>    })<br>    inputTags.render({<br>        elem:'#building',<br>        content: ['栋'],<br>        pinArray: ['栋','号楼'],<br>        openFlatContent: false,<br>        aldaBtn: false,<br>        done: function(){<br>            structShield.building=this.content;<br>        }<br>    })<br>    inputTags.render({<br>        elem:'#unit',<br>        content: ['单元'],<br>        pinArray: ['单元'],<br>        openFlatContent: true,<br>        aldaBtn: false,<br>        done: function(){<br>            structShield.unit=this.content;<br>        }<br>    })<br>});</pre> 
      </div> 
     </div> 
     <div class="layui-card fly-extend-doc"> 
      <div class="layui-card-header"> 
       <h3 class="layui-inline layui-this">下载</h3> 
      </div> 
      <div class="layui-card-body detail-body layui-text"> 
       <div class="layui-btn-container"> <a href="https://gitee.com/xiehanhan/input-tags-enhanced" target="_blank" class="layui-btn layui-btn-lg layui-btn-primary layui-border-red"> 去码云下载 </a> 
        <blockquote class="layui-elem-quote">
          该扩展组件由第三方用户主动投递，并由其自身进行维护，本站仅做收集。 
        </blockquote> 
       </div> 
      </div> 
     </div> 
    </div> 
   </div>
  </div>
  <div class="fly-footer"> 
   <p>Copyright © 2021 <a href="/index.html">layui.itmtr.cn</a> MIT Licensed</p>
  </div>
  <script src="/layui/dist/layui.js"></script>
  <script>// common</script>

 </body>
<script src="/common/common.js"></script>
</html>